package com.TP.www.servlet;

import com.TP.www.service.impl.CustomerAsset;

import static com.TP.www.constant.Constant.SYS_SC;
import static com.TP.www.constant.Constant.loginUser;

/**
 * @author 邱彦祥
 * 用户界面
 */
public class CustomerMenu {
    /**
     * 顾客界面主函数
     */
    public static void showCustomerMain(){
        while (true){
            System.out.println("***********用户界面***********");
            System.out.println("*" + loginUser.getName()  +  "欢迎您使用本系统！*");
            System.out.println("*\t\t1.店铺浏览\t\t\t\t*");
            System.out.println("*\t\t2.查看购物车\t\t\t\t*");
            System.out.println("*\t\t3.查看订单\t\t\t\t*");
            System.out.println("*\t\t4.查看账户余额\t\t\t\t*");
            System.out.println("*\t\t5.充值\t\t\t\t*");
            System.out.println("*\t\t6.用户留言\t\t\t\t*");
            System.out.println("*\t\t0.退出系统\t\t\t\t*");
            System.out.println("*********************************");
            System.out.println("请输入数字指令：");
            String choose = SYS_SC.nextLine();
            switch (choose){
                case "1" :
                    StoreMenu.showStoreForCustomerMain();
                    break;
                case "2" :
                    CartMenu.showCartMain();
                    break;
                case "3" :
                    OrdersMenu.showOrdersForCustomer();
                    break;
                case "4" :
                    System.out.println("**************");
                    System.out.println("当前余额为" + loginUser.getAsset() + "元！");
                    System.out.println("**************");
                    break;
                case "5" :
                    new CustomerAsset().recharge();
                    break;
                case "6" :
                    AppraiseMenu.showAppraiseMain();
                    break;
                case "0":
                    return;
                default:
                    System.out.println("输入有误！请重新输入：");
                    break;
            }
        }
    }
}
